package com.pw.study.flink.transform;

import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.datastream.ConnectedStreams;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class TransFormUnion {
    public static void main(String[] args) {
        dealConnect();
    }


    private static void dealConnect() {
        Configuration conf = new Configuration();
        conf.setInteger("rest.port", 20000);
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(conf);
        env.setParallelism(3);
        DataStreamSource<Integer> stream1 = env.fromElements(1, 2, 3, 4, 5, 6);
        DataStreamSource<Integer> stream2 = env.fromElements(11, 22, 33, 44, 55, 66);
        DataStreamSource<Integer> stream3 = env.fromElements(111, 232, 323, 443, 555, 666);
        DataStream<Integer> un = stream1.union(stream2).union(stream3);
        un.print();

        try {
            env.execute();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
